#include <stdio.h>
//#include <at89x52.h>
//#include "stc89.h"
#include "STC89xx.h"
#include "delay.h"
#include "foo.h"
#include <stdint.h>
#include "uart.h"
#include "C13265-07A.h"
#include "lcd.h"

#define VddCtrl P41
#define VeeCtrl P37
//#define key P43

struct LCD_TypeDef lcd;

void powerOn(void);
void powerOff(void);

void main(void)
{
        lcd.init = C13265_07_init;
        lcd.reset = NULL;
        lcd.powerOn = NULL;
        lcd.powerOff = NULL;
        lcd.imgFull = NULL;
        lcd.imgClear = NULL;
        lcd.imgTest1 = NULL;
        lcd.imgTest2 = NULL;
        lcd.imgTest3 = NULL;
        lcd.imgTest4 = NULL;
        
        InitialUart();

        //test();
        aoi();

        //printf("hello SDCC\r\n");

        while (1)
        {
                //led1 = 0;
                //delayms(1000);
                //l/ed1 = 1;
                //delayms(1000);
                /*if (key == 0)
                {
                        led1 = 0;
                        SBUF = 0x55;
                }
                else
                {
                        led1 = 1;
                        //printf("touch\r\n");
                        SBUF = 0xaa;
                }*/
                //led1 = 0;
                delayms(10);
                //l//ed1 = 1;
                delayms(100);
        }
}

void powerOn(void){
        VddCtrl = 0;
        VeeCtrl = 0;
}

void powerOff(void){
        lcd.powerOff();
        P1 = 0;
        P2 = 0;
        delayms(100);
        VddCtrl = 1;
        VeeCtrl = 1;
        delayms(500);
        
}
